﻿@page "/RecordLock_management"

<h3>记录锁管理页面</h3>

<div class="mb-3">
    <button class="btn btn-primary" @onclick="HandleCleanExpiredLocks">清理过期锁</button>
    <button class="btn btn-primary" @onclick="HandleRefresh">刷新数据</button>
</div>

<table class="table table-striped">
    <thead>
        <tr>
            <th>锁定键</th>
            <th>锁定用户</th>
            <th>锁定时间</th>
            <th>操作</th>
        </tr>
    </thead>
    <tbody>

        @foreach (var lockRecord in RecordLockService.GetAllLockRecords())
        {
            <tr>
                <td>@lockRecord.Key</td>
                <td>@lockRecord.Value.User</td>
                <td>@lockRecord.Value.Timestamp.ToString("yyyy-MM-dd HH:mm:ss")</td>
                <td>
                    <button class="btn btn-danger" @onclick="@(() => HandleReleaseLock(lockRecord.Key))">释放锁</button>
                </td>
            </tr>
        }

    </tbody>
</table>
